<?php if( !empty( $arFiles ) ): ?>
    <div id="sortable">
    <?php foreach( $arFiles as $obj ): ?>
        <div id="id_<?php echo $obj->getId()?>" class="sort_product">
            <div class="sort_picture">
                <?php echo image_tag( '/images/gallery/tiny/' . $obj->getUname()); ?>
            </div>
            <div class="sort_actions">
                <?php echo link_to(
                                image_tag(
                                    'delete.png'
                                    , array(
                                        'alt' => __('Delete')
                                        , 'title' => __('Delete')
                                    )
                                )
                                , 'gallery/removefile?id=' . $gallery->getId() . '&uname=' . $obj->getNameforurl()
                                , array(
                                    'confirm' => __('Are you sure?!')
                                )
                ) ?>
                <?php echo link_to(image_tag('/sf/sf_admin/images/edit_icon.png'
                                            , array('border' => 0))
                                , 'files/editfile?id=' . $obj->getId() . '&parentid=' . $gallery->getId());
                ?>
            </div>
        </div>
    <?php endforeach; ?>
    </div>
<?php endif; ?>
<?php if ($sf_request->hasErrors()): ?>
    <?php foreach ($sf_request->getErrorNames() as $name): ?>
        <span style="color:red; font-weight:bold;"><?php echo __($sf_request->getError($name)); ?></span><br/>
    <?php endforeach; ?>
<?php endif; ?>
<div style="clear: both;"></div>
<?php echo form_tag('gallery/photos', 'method=post multipart=true'); ?>
        <?php echo input_hidden_tag('id', $sf_params->get('id'));?>
        <?php echo input_file_tag('photo'); ?>
        <div style='width: 400px; height: 50px;'>
        <?php echo __('name:'); ?><br />
        <?php echo input_tag('gallery[photoname]', '', array('style' => 'width:220px;')) ?><br />
        </div>
        
        <div style='width: 400px; height: 50px;'>
        <?php echo __('text:'); ?><br />
        <?php echo input_tag('gallery[phototext]', '', array('style' => 'width:220px;')) ?><br />
        </div>
        <?php echo submit_tag('upload'); ?>
</form>